package com.chatdating.entity;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@TableName("payment_record")
public class PaymentRecord {
    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField("order_no")
    private String orderNo;

    @TableField("transaction_id")
    private String transactionId;

    @TableField("payment_amount")
    private BigDecimal paymentAmount;

    @TableField("payment_status")
    private Integer paymentStatus;

    @TableField("payment_method")
    private Integer paymentMethod;

    @TableField("payment_time")
    private LocalDateTime paymentTime;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField("notify_data")
    private String notifyData;

    // 设置回调数据（自动转换为JSON）
    public void setNotifyData(Object data) {
        this.notifyData = JSON.toJSONString(data);
    }
}